<?php
date_default_timezone_set("PRC");
//header("Content-type: text/html; charset=utf8");
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_bar.php');
require_once ('jpgraph/jpgraph_line.php');



$monthstr=$_GET['monthstr'];
$salestr=$_GET['salestr'];

$montharray=explode(",",$monthstr);
$salearray=explode(",",$salestr);

$xarray=array();
$yarray2=array();
$xarray['0']=0;
for($i=1;$i<=count($montharray);$i+=1){
    $xarray[$i]=$montharray[$i-1];
}

for($i=0;$i<count($salearray);$i+=1){
    $yarray2[$i]=(double)$salearray[$i];
}



$graph = new Graph(600,360);
$graph->img->SetMargin(90,50,50,50);
$graph->SetScale("textlin");
$graph->SetShadow();

//$graph->title->Set('Center the line points in bars');
//设置图表的标题字体、大小
$graph->title->Set(iconv("UTF-8","GB2312//IGNORE","year sales"));
$graph->xaxis->title->Set(iconv("UTF-8","GB2312//IGNORE","month"));
$graph->yaxis->title->Set(iconv("UTF-8","GB2312//IGNORE","sales"));
$graph->yaxis->title->SetMargin(15);
//和上面标题对应，设置标题的字体和大小
//$graph->title->SetFont(FF_SIMSUN,FS_BOLD,15);
//$graph->yaxis->title->SetFont(FF_SIMSUN,FS_BOLD,12);
//$graph->xaxis->title->SetFont(FF_SIMSUN,FS_BOLD,12);


$line = new LinePlot($yarray2);
$line->SetBarCenter();
$line->SetWeight(2);



$line->mark->SetType(MARK_UTRIANGLE);
$line->mark->SetColor('blue');
$line->mark->SetFillColor('red');

$graph->xaxis->SetTickLabels($xarray);
$graph->Add($line);

// Output line
$graph->Stroke();


?>





